package com.TestDemo.Test2;

import java.util.Calendar;
import java.util.Date;

public class TimeCalendarTest {
    public static void main(String[] args) {

        Calendar instance = Calendar.getInstance();

        System.out.println(instance.getTime());
        int month = instance.get(Calendar.MONTH) + 1;
        System.out.println("month = " + month);

        Date time = instance.getTime();

        System.out.println(time);


        System.out.println("-------------");

        StringBuffer stringBuffer = new StringBuffer();
        int i = instance.get(Calendar.YEAR);
        int i1 = instance.get(Calendar.MONTH)+1;


        stringBuffer.append(i+":");

        stringBuffer.append(i1+":");

        stringBuffer.append(instance.get(Calendar.DAY_OF_MONTH));


        System.out.println(stringBuffer);


        System.out.println("-----------------------");

        System.out.println(new Date());
        System.out.println(Calendar.getInstance().getTime());





    }
}
